<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function doSelect() {
            var degree = document.getElementById('degree')
            // console.log(degree.length);
            // degree.length = 0 // 清空下拉列表

            // console.log(degree.selectedIndex);
            // degree.selectedIndex = 3

            // console.log(degree.value);

            // var opts = degree.options
            // // console.log(opts);
            // for(var opt of opts){
            //     console.log(opt.text, opt.value);
            // }

            // var opt = new Option('博士','boshi')
            // degree.add(opt)
        }

        window.onload = function () {
            // 绑定onchange
            document.getElementById('degree').onchange = function () {
                console.log(this.value);
            }
        }
    </script>
</head>
<body>
    <button onclick="doSelect()">操作下拉列表</button>
    <hr>

    学历：
    <select id="degree">
        <option value="0">--请选择学历--</option>
        <option value="dazhuang">大专</option>
        <option value="benke">本科</option>
        <option value="yajiusheng">研究生</option>
    </select>
</body>
</html>